/* GitCode 代码树查看器样式 */
#gitcode-tree-viewer {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  height: 100vh;
  background: #ffffff;
  border-left: 1px solid #e1e4e8;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 13px;
  overflow: hidden;
}

.gitcode-tree-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f6f8fa;
  border-bottom: 1px solid #e1e4e8;
  flex-shrink: 0;
}

.gitcode-tree-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #24292e;
  font-size: 14px;
}

.gitcode-tree-title svg {
  color: #586069;
}

.gitcode-tree-controls {
  display: flex;
  gap: 8px;
}

.gitcode-tree-toggle,
.gitcode-tree-close,
.gitcode-tree-back,
.gitcode-tree-settings {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 18px;
  color: #586069;
  line-height: 1;
  border-radius: 3px;
  transition: background-color 0.2s;
}

.gitcode-tree-toggle:hover,
.gitcode-tree-close:hover,
.gitcode-tree-back:hover,
.gitcode-tree-settings:hover {
  background: #e1e4e8;
  color: #24292e;
}

.gitcode-tree-settings {
  font-size: 16px;
}

.gitcode-tree-back {
  font-size: 16px;
  font-weight: bold;
}

.gitcode-tree-search {
  padding: 12px 16px;
  border-bottom: 1px solid #e1e4e8;
  flex-shrink: 0;
}

.gitcode-tree-search-input {
  width: 100%;
  padding: 6px 12px;
  border: 1px solid #d1d5da;
  border-radius: 6px;
  font-size: 13px;
  background: #ffffff;
  transition: border-color 0.2s;
}

.gitcode-tree-search-input:focus {
  outline: none;
  border-color: #0366d6;
  box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.1);
}

.gitcode-tree-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
}

.gitcode-tree-content::-webkit-scrollbar {
  width: 8px;
}

.gitcode-tree-content::-webkit-scrollbar-track {
  background: #f6f8fa;
}

.gitcode-tree-content::-webkit-scrollbar-thumb {
  background: #c6cbd1;
  border-radius: 4px;
}

.gitcode-tree-content::-webkit-scrollbar-thumb:hover {
  background: #959da5;
}

.gitcode-tree-item {
  user-select: none;
}

.gitcode-tree-item-content {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 28px;
  border-radius: 4px;
  margin: 2px 8px;
}

/* 移除所有悬停效果 */
.gitcode-tree-item-content:hover {
  background: transparent;
}

/* 当前文件样式 - 只高亮当前文件 */
.gitcode-tree-item.current-file .gitcode-tree-item-content {
  background: #e3f2fd !important;
  border-left: 3px solid #0366d6;
  font-weight: 500;
}

.gitcode-tree-item.current-file .gitcode-tree-name {
  color: #0366d6 !important;
}

.gitcode-tree-item.current-file .gitcode-tree-icon {
  color: #0366d6 !important;
  opacity: 1;
}

/* 目录项样式 - 不使用蓝色 */
.gitcode-tree-item[data-type="tree"] .gitcode-tree-name {
  color: #24292e;
  font-weight: 500;
}

/* 文件项样式 */
.gitcode-tree-item[data-type="blob"] .gitcode-tree-name {
  color: #24292e;
}

.gitcode-tree-toggle-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #586069;
  cursor: pointer;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.gitcode-tree-toggle-icon.expanded {
  transform: rotate(90deg);
}

.gitcode-tree-spacer {
  width: 16px;
  flex-shrink: 0;
}

.gitcode-tree-icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  opacity: 0.7;
}

.gitcode-tree-item[data-type="tree"] .gitcode-tree-icon {
  color: #586069;
  opacity: 0.8;
}

.gitcode-tree-item[data-type="blob"] .gitcode-tree-icon {
  color: #586069;
  opacity: 0.8;
}

.gitcode-tree-name {
  flex: 1;
  color: #24292e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  line-height: 1.5;
}

.gitcode-tree-icon {
  font-size: 14px;
  opacity: 0.8;
}

.gitcode-tree-children {
  display: block;
}

.gitcode-tree-loading,
.gitcode-tree-error,
.gitcode-tree-empty {
  padding: 24px 16px;
  text-align: center;
  color: #586069;
  font-size: 13px;
}

.gitcode-tree-error {
  color: #cb2431;
}

.gitcode-tree-retry {
  margin-top: 8px;
  padding: 6px 12px;
  background: #0366d6;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s;
}

.gitcode-tree-retry:hover {
  background: #0256cc;
}

.gitcode-tree-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: col-resize;
  background: transparent;
  transition: background-color 0.2s;
}

.gitcode-tree-resize-handle:hover {
  background: #0366d6;
}

/* 高亮匹配的搜索结果 */
.gitcode-tree-item[data-highlight="true"] .gitcode-tree-name {
  background: #fff3cd;
  padding: 2px 4px;
  border-radius: 3px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  #gitcode-tree-viewer {
    width: 100%;
    max-width: 320px;
  }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
  #gitcode-tree-viewer {
    background: #1c2128;
    border-left-color: #30363d;
  }

  .gitcode-tree-header {
    background: #161b22;
    border-bottom-color: #30363d;
  }

  .gitcode-tree-title {
    color: #c9d1d9;
  }

  .gitcode-tree-title svg {
    color: #8b949e;
  }

  .gitcode-tree-toggle,
  .gitcode-tree-close {
    color: #8b949e;
  }

  .gitcode-tree-toggle:hover,
  .gitcode-tree-close:hover {
    background: #30363d;
    color: #c9d1d9;
  }

  .gitcode-tree-search {
    border-bottom-color: #30363d;
  }

  .gitcode-tree-search-input {
    background: #0d1117;
    border-color: #30363d;
    color: #c9d1d9;
  }

  .gitcode-tree-search-input:focus {
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
  }

  .gitcode-tree-content {
    background: #1c2128;
  }

  .gitcode-tree-content::-webkit-scrollbar-track {
    background: #161b22;
  }

  .gitcode-tree-content::-webkit-scrollbar-thumb {
    background: #30363d;
  }

  .gitcode-tree-content::-webkit-scrollbar-thumb:hover {
    background: #484f58;
  }

  .gitcode-tree-item-content:hover {
    background: transparent;
  }
  
  .gitcode-tree-item[data-type="tree"] .gitcode-tree-name {
    color: #c9d1d9;
  }
  
  .gitcode-tree-item[data-type="blob"] .gitcode-tree-name {
    color: #c9d1d9;
  }

  .gitcode-tree-toggle-icon {
    color: #8b949e;
  }

  .gitcode-tree-name {
    color: #c9d1d9;
  }

  .gitcode-tree-loading,
  .gitcode-tree-error,
  .gitcode-tree-empty {
    color: #8b949e;
  }
}

/* Token设置面板样式 */
.gitcode-tree-token-panel {
  background: #ffffff;
  border-bottom: 1px solid #e1e4e8;
  padding: 16px;
  flex-shrink: 0;
}

.gitcode-tree-token-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 14px;
  color: #24292e;
}

.gitcode-tree-token-close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 20px;
  color: #586069;
  line-height: 1;
  border-radius: 3px;
  transition: background-color 0.2s;
}

.gitcode-tree-token-close:hover {
  background: #e1e4e8;
  color: #24292e;
}

.gitcode-tree-token-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gitcode-tree-token-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5da;
  border-radius: 6px;
  font-size: 13px;
  font-family: monospace;
  box-sizing: border-box;
}

.gitcode-tree-token-input:focus {
  outline: none;
  border-color: #0366d6;
  box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.1);
}

.gitcode-tree-token-info {
  font-size: 11px;
  color: #586069;
  line-height: 1.6;
  background: #f6f8fa;
  padding: 10px;
  border-radius: 4px;
}

.gitcode-tree-token-info p {
  margin: 4px 0;
}

.gitcode-tree-token-save {
  padding: 8px 16px;
  background: #0366d6;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.2s;
}

.gitcode-tree-token-save:hover {
  background: #0256cc;
}

.gitcode-tree-token-save:active {
  background: #0249b8;
}

/* 暗色主题下的Token面板 */
@media (prefers-color-scheme: dark) {
  .gitcode-tree-token-panel {
    background: #1c2128;
    border-bottom-color: #30363d;
  }

  .gitcode-tree-token-header {
    color: #c9d1d9;
  }

  .gitcode-tree-token-close {
    color: #8b949e;
  }

  .gitcode-tree-token-close:hover {
    background: #30363d;
    color: #c9d1d9;
  }

  .gitcode-tree-token-input {
    background: #0d1117;
    border-color: #30363d;
    color: #c9d1d9;
  }

  .gitcode-tree-token-input:focus {
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
  }

  .gitcode-tree-token-info {
    background: #161b22;
    color: #8b949e;
  }
}

